using System;
using ODT.Common.Core;
using ODT.Common.Services;
using ODT.EtherCat.Core;
using ODT.Intellisense;
using ODT.Common.WPF;
using ODT.PowerPmacComLib;

namespace ppplotapp.Plot
{
	public sealed class PlotCommand
	{
		private ILanguageTranslationService languageTranslationService;

		private IApplicationSettingsService applicationSettingsService;

		private IDeviceSettingsService deviceSettingsService;

		private ICultureService cultureService;

		private IEtherCatVariableService etherCatVariableService;

		private global::PPPlotControl.PPPlotControl plotForm;

		public PlotCommand()
        {
            ServiceManager.LoadIfNotExists<ODT.PPMACDatabase.Bindings>();
            ServiceManager.Load<ODT.EtherCat.Bindings>();
            ServiceManager.Load<ODT.Intellisense.Bindings>();
            ServiceManager.Load<ODT.Intellisense.ExternalBindings>();
            ServiceManager.Load<ODT.Common.WPF.Bindings>();
            ServiceManager.Load<ODT.PowerPmacComLib.Bindings>();

            this.languageTranslationService = ServiceManager.GetService<ILanguageTranslationService>();
            this.applicationSettingsService = ServiceManager.GetService<IApplicationSettingsService>();
            this.deviceSettingsService = ServiceManager.GetService<IDeviceSettingsService>();
            this.cultureService = ServiceManager.GetService<ICultureService>();
            this.etherCatVariableService = ServiceManager.GetService<IEtherCatVariableService>();

            plotForm = new global::PPPlotControl.PPPlotControl(languageTranslationService, applicationSettingsService, deviceSettingsService, cultureService, etherCatVariableService);
            plotForm.Show();

            plotForm.SetIDECommunicationValues();
        }

		public PPPlotControl.PPPlotControl PlotForm()
		{
			return plotForm;
        }
	}
}
